package com.ugoodtech.mdcc.client;

import com.ugoodtech.mdcc.client.dto.JsonResponse;
import com.ugoodtech.mdcc.client.service.StationServiceReportService;
import com.ugoodtech.mdcc.core.domain.User;
import com.ugoodtech.mdcc.core.repository.UserRepository;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.security.Principal;

@Api(description = "常规报告相关接口")
@RestController
@RequestMapping("/stationServiceReport")
public class StationServiceReportController {

    @Autowired
    private StationServiceReportService stationServiceReportService;

    @Autowired
    private UserRepository userRepository;

//    @ApiOperation("创建常规报告")
//    @RequestMapping("create")
//    public JsonResponse createStationServiceReport(@ApiParam("维修站ID") @RequestParam(value = "stationId") Long stationId,
//                                                   @ApiParam("自我评价") @RequestParam(value = "selfAssessment") String selfAssessment,
//                                                   @ApiParam("服务工作照片") @RequestParam(value = "workPhotos") String workPhotos,
//                                                   @ApiParam("单选题1中文答案") @RequestParam(value = "answer1") String answer1,
//                                                   @ApiParam("单选题1代码") @RequestParam(value = "value1") String value1,
//                                                   @ApiParam("单选题2中文答案") @RequestParam(value = "answer2") String answer2,
//                                                   @ApiParam("单选题2代码") @RequestParam(value = "value2") String value2,
//                                                   Principal principal) {
//        User clientUser = userRepository.findByUsername(principal.getName());
//        if (clientUser == null) {
//            return JsonResponse.errorResponseWithError("500", "未找到此用户");
//        }
//        return stationServiceReportService.createStationServiceReport(stationId, clientUser, selfAssessment, workPhotos, answer1, value1, answer2, value2, "complete");
//    }

}
